<?php
/**
 * Object Relational Persistence Mapping Class for table: chronic_disease
 *
 * @package	com.athena
 * @author	LHV
 */
class ChronicDisease extends ORDataObject {

	/**#@+
	 * Fields of table: chronic_disease mapped to class members
	 */
	var $chronic_disease_id		= 	'';
	var $deleted 				=	'';
	var $vi_name				=	'';
	var $en_name				=	'';
	/**#@-*/


	/**
	 * DB Table
	 */
	var $_table = 'chronic_disease';

	/**
	 * Primary Key
	 */
	var $_key = 'chronic_disease_id';

	/**
	 * Internal Name
	 */
	var $_internalName = 'ChronicDisease';

	/**
	 * Handle instantiation
	 */
	function ChronicDisease() {
		parent::ORDataObject();
	}

	public function listAll() {
		$field	=	L10nHelper::getLocale();
		$field = L10nHelper::changeField($field, "name");
		$ds = new Datasource_sql();
		$sql = array (
			'cols' 		=> "chronic_disease_id, $field as name, deleted",
			'from'		=> "$this->_table",
			'orderby'	=> "name");
		$ds->setup($this->_db, $sql);
		return $ds->toArray();
	}

	public function getChronicDiseaseList(){
		$field	=	L10nHelper::getLocale();
		$field = L10nHelper::changeField($field, "name");
		$ds = new Datasource_sql();
		$sql = array (
			'cols' 		=> 	"chronic_disease_id, $field as name",
			'from'		=> 	"$this->_table",
			'where'		=>	"deleted=0",
			'orderby'	=> 	"name"
		);
		$ds->setup($this->_db, $sql);
		return $ds->toArray('chronic_disease_id', 'name');
	}

}
?>
